{
   const token = localStorage.getItem('Token')
   const eles = document.getElementsByTagName('script')
   const ele = eles[eles.length - 1]
   if (ele.hasAttribute('v')) {
      if (!token) location.href = '/view/login'
   }
   $.ajaxSetup({
      beforeSend(xhr) {
         xhr.setRequestHeader('authorization', 'Bearer ' + token)
      }
   });

   // 头像 
   $(() => {
      $.get('/api/me', res => {
         if (res.code == 200)
            $('.profile_image').attr('src', '/profile/' + res.profile || '').parent('.profile_img').show().siblings('.login').hide()
      })
   })
}